﻿using PasswordManagerMVC.Models;
using PwdMgr.CommonContract;

namespace PasswordManagerMVC.Utilities
{
    public class Converter
    {
        public static UserInfo ToUserInfo(RegisterModel model)
        {
            return new UserInfo
            {
                UserName = model.UserName,
                Password = model.Password,
                Email = model.Email,
            };
        }

        public static ItemModel ToItemModel(SensitiveInfo info)
        {
            return new ItemModel
            {
                ID = info.ID,
                UserName = info.Username,
                Password = info.Password,
                Tag1 = info.Tag1,
                Tag2 = info.Tag2,
                Tag3 = info.Tag3,
                Tag4 = info.Tag4,
                Tag5 = info.Tag5,
            };
        }
        public static SensitiveInfo ToSensitiveInfo(ItemModel model)
        {
            return new SensitiveInfo
            {
                ID = model.ID,
                Username = model.UserName,
                Password = model.Password,
                Tag1 = model.Tag1,
                Tag2 = model.Tag2,
                Tag3 = model.Tag3,
                Tag4 = model.Tag4,
                Tag5 = model.Tag5,
            };
        }
    }
}